package com.qinggeng.project.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.qinggeng.framework.aspectj.lang.annotation.Log;
import com.qinggeng.framework.aspectj.lang.enums.BusinessType;
import com.qinggeng.project.system.domain.JobInfoBrowse;
import com.qinggeng.project.system.service.IJobInfoBrowseService;
import com.qinggeng.framework.web.controller.BaseController;
import com.qinggeng.framework.web.domain.AjaxResult;
import com.qinggeng.common.utils.poi.ExcelUtil;
import com.qinggeng.framework.web.page.TableDataInfo;
/**
 * 招聘信息浏览记录Controller
 * 
 * @author smallfish
 * @date 2020-12-24
 */
@RestController
@RequestMapping("/system/browse")
public class JobInfoBrowseController extends BaseController
{
    @Autowired
    private IJobInfoBrowseService jobInfoBrowseService;

    /**
     * 查询招聘信息浏览记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:browse:list')")
    @GetMapping("/list")
    public TableDataInfo list(JobInfoBrowse jobInfoBrowse)
    {
        startPage();
        List<JobInfoBrowse> list = jobInfoBrowseService.selectJobInfoBrowseList(jobInfoBrowse);
        return getDataTable(list);
    }

    /**
     * 导出招聘信息浏览记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:browse:export')")
    @Log(title = "招聘信息浏览记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(JobInfoBrowse jobInfoBrowse)
    {
        List<JobInfoBrowse> list = jobInfoBrowseService.selectJobInfoBrowseList(jobInfoBrowse);
        ExcelUtil<JobInfoBrowse> util = new ExcelUtil<JobInfoBrowse>(JobInfoBrowse.class);
        return util.exportExcel(list, "browse");
    }

    /**
     * 获取招聘信息浏览记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:browse:query')")
    @GetMapping(value = "/{browseId}")
    public AjaxResult getInfo(@PathVariable("browseId") Long browseId)
    {
        return AjaxResult.success(jobInfoBrowseService.selectJobInfoBrowseById(browseId));
    }

    /**
     * 新增招聘信息浏览记录
     */
    @PreAuthorize("@ss.hasPermi('system:browse:add')")
    @Log(title = "招聘信息浏览记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JobInfoBrowse jobInfoBrowse)
    {
        return toAjax(jobInfoBrowseService.insertJobInfoBrowse(jobInfoBrowse));
    }

    /**
     * 修改招聘信息浏览记录
     */
    @PreAuthorize("@ss.hasPermi('system:browse:edit')")
    @Log(title = "招聘信息浏览记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JobInfoBrowse jobInfoBrowse)
    {
        return toAjax(jobInfoBrowseService.updateJobInfoBrowse(jobInfoBrowse));
    }

    /**
     * 删除招聘信息浏览记录
     */
    @PreAuthorize("@ss.hasPermi('system:browse:remove')")
    @Log(title = "招聘信息浏览记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{browseIds}")
    public AjaxResult remove(@PathVariable Long[] browseIds)
    {
        return toAjax(jobInfoBrowseService.deleteJobInfoBrowseByIds(browseIds));
    }
}
